<template>
  <view>
    <up-navbar
      :title="title"
      @leftClick="leftClick"
      @rightClick="rightClick"
      :autoBack="false"
      :placeholder="true"
      :leftIconSize="leftIconSize"
    >
      <!-- <template #left>
        <view class="u-nav-slot">
          <up-icon name="arrow-left" size="19"></up-icon>
          <up-line
            direction="column"
            :hairline="false"
            length="16"
            margin="0 8px"
          ></up-line>
          <up-icon name="home" size="20"></up-icon>
        </view>
      </template> -->
    </up-navbar>
  </view>
</template>

<script setup>
import { ref, onMounted } from "vue";

// 定义组件属性
const props = defineProps({
  title: {
    type: String,
    default: "标题",
  },
  leftIconSize: {
    type: Number,
    default: 20,
  },
});

// 定义方法
const rightClick = () => {};

const leftClick = () => {
  var pages = getCurrentPages();
  if (pages && pages.length > 1) {
    uni.navigateBack();
  } else {
    uni.switchTab({
      url: "/pages/index/index",
    });
  }
};
</script>

<style lang="scss" scoped></style>
